.class Lcom/baidu/bg;
.super Lcom/baidu/l;


# instance fields
.field private k:Ljava/util/Map;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Lcom/baidu/GifAnimView;",
            ">;"
        }
    .end annotation
.end field

.field private l:I


# direct methods
.method public constructor <init>(Lcom/baidu/AdView;)V
    .locals 3

    const/4 v2, 0x1

    invoke-direct {p0, p1}, Lcom/baidu/l;-><init>(Lcom/baidu/AdView;)V

    new-instance v0, Ljava/util/HashMap;

    invoke-direct {v0}, Ljava/util/HashMap;-><init>()V

    iput-object v0, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    const/16 v0, 0xff

    iput v0, p0, Lcom/baidu/bg;->l:I

    const-string v0, "ImageAdContainer"

    const-string v1, "{"

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    invoke-virtual {p0, v2}, Lcom/baidu/bg;->setFocusable(Z)V

    invoke-virtual {p0, v2}, Lcom/baidu/bg;->setClickable(Z)V

    const-string v0, "ImageAdContainer"

    const-string v1, "}"

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    return-void
.end method

.method private l()V
    .locals 7

    const/4 v6, 0x0

    const/4 v5, 0x0

    const/4 v4, -0x1

    iget-object v0, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    if-nez v0, :cond_0

    :goto_0
    return-void

    :cond_0
    iget-object v0, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    invoke-interface {v0}, Ljava/util/Map;->entrySet()Ljava/util/Set;

    move-result-object v0

    invoke-interface {v0}, Ljava/util/Set;->iterator()Ljava/util/Iterator;

    move-result-object v2

    :goto_1
    invoke-interface {v2}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    invoke-interface {v2}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map$Entry;

    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Lcom/baidu/GifAnimView;

    const/16 v3, 0x8

    invoke-virtual {v1, v3}, Lcom/baidu/GifAnimView;->setVisibility(I)V

    invoke-interface {v0}, Ljava/util/Map$Entry;->getValue()Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/baidu/GifAnimView;

    invoke-virtual {v0}, Lcom/baidu/GifAnimView;->a()V

    goto :goto_1

    :cond_1
    invoke-virtual {p0, v6}, Lcom/baidu/bg;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    sget-object v0, Lcom/baidu/bi;->a:[I

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->n()Lcom/baidu/bj;

    move-result-object v1

    invoke-virtual {v1}, Lcom/baidu/bj;->ordinal()I

    move-result v1

    aget v0, v0, v1

    packed-switch v0, :pswitch_data_0

    :goto_2
    iget-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    if-eqz v0, :cond_2

    iget-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    invoke-virtual {p0, v0}, Lcom/baidu/bg;->removeView(Landroid/view/View;)V

    iput-object v6, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    :cond_2
    new-instance v0, Landroid/widget/ImageView;

    invoke-virtual {p0}, Lcom/baidu/bg;->getContext()Landroid/content/Context;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/widget/ImageView;-><init>(Landroid/content/Context;)V

    iput-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    new-instance v0, Landroid/widget/RelativeLayout$LayoutParams;

    iget v1, p0, Lcom/baidu/bg;->h:I

    iget v2, p0, Lcom/baidu/bg;->h:I

    invoke-direct {v0, v1, v2}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    const/16 v1, 0xf

    invoke-virtual {v0, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    const/16 v1, 0xb

    invoke-virtual {v0, v1}, Landroid/widget/RelativeLayout$LayoutParams;->addRule(I)V

    iget-object v1, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    invoke-virtual {v1, v0}, Landroid/widget/ImageView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    iget-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->e()Landroid/graphics/Bitmap;

    move-result-object v1

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    iget-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    iget v1, p0, Lcom/baidu/bg;->l:I

    int-to-double v1, v1

    const-wide v3, 0x3fe999999999999aL

    mul-double/2addr v1, v3

    double-to-int v1, v1

    invoke-virtual {v0, v1}, Landroid/widget/ImageView;->setAlpha(I)V

    iget-object v0, p0, Lcom/baidu/bg;->e:Landroid/widget/ImageView;

    invoke-virtual {p0, v0}, Lcom/baidu/bg;->addView(Landroid/view/View;)V

    goto/16 :goto_0

    :pswitch_0
    new-instance v0, Landroid/graphics/drawable/BitmapDrawable;

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->c()Landroid/graphics/Bitmap;

    move-result-object v1

    invoke-direct {v0, v1}, Landroid/graphics/drawable/BitmapDrawable;-><init>(Landroid/graphics/Bitmap;)V

    iget v1, p0, Lcom/baidu/bg;->l:I

    invoke-virtual {v0, v1}, Landroid/graphics/drawable/BitmapDrawable;->setAlpha(I)V

    invoke-virtual {p0, v0}, Lcom/baidu/bg;->setBackgroundDrawable(Landroid/graphics/drawable/Drawable;)V

    goto :goto_2

    :pswitch_1
    iget-object v0, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->m()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->containsKey(Ljava/lang/Object;)Z

    move-result v0

    if-nez v0, :cond_3

    new-instance v0, Lcom/baidu/GifAnimView;

    invoke-virtual {p0}, Lcom/baidu/bg;->getContext()Landroid/content/Context;

    move-result-object v1

    new-instance v2, Lcom/baidu/bh;

    invoke-direct {v2, p0}, Lcom/baidu/bh;-><init>(Lcom/baidu/bg;)V

    invoke-direct {v0, v1, v2}, Lcom/baidu/GifAnimView;-><init>(Landroid/content/Context;Lcom/baidu/bf;)V

    invoke-virtual {p0}, Lcom/baidu/bg;->getContext()Landroid/content/Context;

    move-result-object v1

    iget-object v2, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v2}, Lcom/baidu/Ad;->a()Ljava/lang/String;

    move-result-object v2

    invoke-static {v5, v1, v2}, Lcom/baidu/w;->e(ZLandroid/content/Context;Ljava/lang/String;)[B

    move-result-object v1

    invoke-virtual {v0, v1}, Lcom/baidu/GifAnimView;->a([B)V

    invoke-virtual {p0, v0}, Lcom/baidu/bg;->addView(Landroid/view/View;)V

    iget-object v1, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    iget-object v2, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v2}, Lcom/baidu/Ad;->m()Ljava/lang/String;

    move-result-object v2

    invoke-interface {v1, v2, v0}, Ljava/util/Map;->put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;

    :goto_3
    new-instance v1, Landroid/widget/RelativeLayout$LayoutParams;

    invoke-direct {v1, v4, v4}, Landroid/widget/RelativeLayout$LayoutParams;-><init>(II)V

    invoke-virtual {v0, v1}, Lcom/baidu/GifAnimView;->setLayoutParams(Landroid/view/ViewGroup$LayoutParams;)V

    invoke-virtual {p0}, Lcom/baidu/bg;->getLayoutParams()Landroid/view/ViewGroup$LayoutParams;

    move-result-object v1

    iget v2, v1, Landroid/view/ViewGroup$LayoutParams;->width:I

    iget v1, v1, Landroid/view/ViewGroup$LayoutParams;->height:I

    invoke-virtual {v0, v2, v1}, Lcom/baidu/GifAnimView;->a(II)V

    iget v1, p0, Lcom/baidu/bg;->l:I

    invoke-virtual {v0, v1}, Lcom/baidu/GifAnimView;->a(I)V

    goto/16 :goto_2

    :cond_3
    iget-object v0, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->m()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lcom/baidu/GifAnimView;

    invoke-virtual {v0, v5}, Lcom/baidu/GifAnimView;->setVisibility(I)V

    invoke-virtual {v0}, Lcom/baidu/GifAnimView;->b()V

    goto :goto_3

    :pswitch_data_0
    .packed-switch 0x1
        :pswitch_0
        :pswitch_1
    .end packed-switch
.end method


# virtual methods
.method public a(I)V
    .locals 0

    return-void
.end method

.method public a(Lcom/baidu/Ad;Lcom/baidu/t;ILcom/baidu/ag;)V
    .locals 4

    const-string v0, "ImageAdContainer"

    const-string v1, "setAd"

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    iget v0, p4, Lcom/baidu/ag;->a:I

    iput v0, p0, Lcom/baidu/bg;->g:I

    iget v0, p4, Lcom/baidu/ag;->b:I

    iput v0, p0, Lcom/baidu/bg;->h:I

    const-wide v0, 0x3fbaaaaaa0000000L

    iget v2, p0, Lcom/baidu/bg;->h:I

    int-to-double v2, v2

    mul-double/2addr v0, v2

    double-to-int v0, v0

    iput v0, p0, Lcom/baidu/bg;->c:I

    if-eqz p1, :cond_0

    invoke-virtual {p1}, Lcom/baidu/Ad;->c()Landroid/graphics/Bitmap;

    move-result-object v0

    if-nez v0, :cond_1

    :cond_0
    new-instance v0, Ljava/lang/IllegalArgumentException;

    invoke-direct {v0}, Ljava/lang/IllegalArgumentException;-><init>()V

    throw v0

    :cond_1
    const/4 v0, 0x0

    iput-boolean v0, p0, Lcom/baidu/bg;->d:Z

    iput-object p1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-direct {p0}, Lcom/baidu/bg;->l()V

    invoke-super {p0, p1, p2, p3, p4}, Lcom/baidu/l;->a(Lcom/baidu/Ad;Lcom/baidu/t;ILcom/baidu/ag;)V

    return-void
.end method

.method public b(I)V
    .locals 1

    iget v0, p0, Lcom/baidu/bg;->l:I

    if-eq v0, p1, :cond_1

    const/4 v0, 0x1

    :goto_0
    iput p1, p0, Lcom/baidu/bg;->l:I

    if-eqz v0, :cond_0

    invoke-direct {p0}, Lcom/baidu/bg;->l()V

    :cond_0
    return-void

    :cond_1
    const/4 v0, 0x0

    goto :goto_0
.end method

.method public setBackgroundColor(I)V
    .locals 0

    return-void
.end method

.method public setVisibility(I)V
    .locals 3

    invoke-virtual {p0}, Lcom/baidu/bg;->getVisibility()I

    move-result v0

    if-ne v0, p1, :cond_1

    :cond_0
    :goto_0
    return-void

    :cond_1
    invoke-super {p0, p1}, Lcom/baidu/l;->setVisibility(I)V

    const-string v0, "ImageAdContainer.setVisibility"

    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    const-string v2, "visibility:"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1, p1}, Ljava/lang/StringBuilder;->append(I)Ljava/lang/StringBuilder;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-static {v0, v1}, Lcom/baidu/bk;->b(Ljava/lang/String;Ljava/lang/String;)I

    :try_start_0
    iget-object v0, p0, Lcom/baidu/bg;->k:Ljava/util/Map;

    iget-object v1, p0, Lcom/baidu/bg;->b:Lcom/baidu/Ad;

    invoke-virtual {v1}, Lcom/baidu/Ad;->m()Ljava/lang/String;

    move-result-object v1

    invoke-interface {v0, v1}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/baidu/GifAnimView;

    if-eqz p0, :cond_0

    if-eqz p1, :cond_2

    invoke-virtual {p0}, Lcom/baidu/GifAnimView;->a()V
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    invoke-static {v0}, Lcom/baidu/bk;->a(Ljava/lang/Throwable;)I

    goto :goto_0

    :cond_2
    :try_start_1
    invoke-virtual {p0}, Lcom/baidu/GifAnimView;->b()V
    :try_end_1
    .catch Ljava/lang/Exception; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_0
.end method
